#pragma once

#include <gofcl_usbfs_r.h>

typedef struct {
	u32_s EPNUM : 4;
	u32_s BCOUNT : 11;
	u32_s DPID : 2;
	u32_s RPCKST : 4;
	u32_s : 11;
} usbfs_grstat_dev_s;

_Static_assert(sizeof(usbfs_grstat_dev_s) == 4,
	       "Struct usbfs_grstat_dev_s defined error!");

static inline usbfs_grstat_dev_s usbfs_rreg_grstatr_dev_s(void) {
	union {
		usbfs_grstat_dev_s g;
		u32_s u;
	} gu = {
		.u = usbfs_rreg(USBFS_GRSTATR_R),
	};
	return gu.g;
}

static inline usbfs_grstat_dev_s usbfs_rreg_grstatp_dev_s(void) {
	union {
		usbfs_grstat_dev_s g;
		u32_s u;
	} gu = {
		.u = usbfs_rreg(USBFS_GRSTATP_R),
	};
	return gu.g;
}
